package com.ysd.gulimall.product.controller;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClient;
import com.ysd.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: zz.lv
 * Date: 2020/7/14
 * Time: 11:16 上午
 */

@RestController
@RequestMapping("product/image")

public class ImageController {

//    @Autowired
//    OSS ossClient;
//    @Autowired
//    OSSClient ossClient;
//
//    /**
//     * 上传图片
//     */
//    @RequestMapping("/upload")
//    public R list(@RequestParam Map<String, Object> params) throws FileNotFoundException {
//        String bucketName = "ysd-gulimall";
//        String localFile = "/Users/zz/Desktop/test.jpg";
//        String fileKeyName = "0.png";
//        InputStream inputStream = new FileInputStream(localFile);
//        ossClient.putObject(bucketName, fileKeyName, inputStream);
//        ossClient.shutdown();
//
//        return R.ok().put("data", "success");
//    }
}
